package com.studiofortress.sf.structure.intersection; 
 
import com.studiofortress.sf.structure.Actor;

/**
 * Represents the given actor as a single pixel during
 * collisions. The pixel will be the Actors current X
 * and Y location in the world.
 * @author Joseph Lenton
 * @version 08/08/2008
 */
public class PixelIntersection extends Intersection
{
    /**
     * @param actor The actor this PixelIntersection is working with, cannot be null.
     */
    public PixelIntersection(Actor actor)
    {
        super(actor);
    }
    
    @Override
    public boolean isIntersection(Intersection other)
    {
        return other.isIntersectionToPixel(this);
    }
     
    @Override
    protected boolean isIntersectionToPixel(PixelIntersection other)
    {
        Actor thisActor = getActor();
        Actor otherActor = other.getActor();
        
        return thisActor.getX() == otherActor.getX() &&
                thisActor.getY() == otherActor.getY();
    }
    
    @Override
    protected boolean isIntersectionToBounds(BoundsIntersection other)
    {
        return Intersection.intersectionPixelToBounds(getActor(), other.getActor());
    }
    
    @Override
    protected boolean isIntersectionToImage(ImageIntersection other)
    {
        return Intersection.intersectionPixelToImage(getActor(), other.getActor());
    }
    
    @Override
    protected boolean isIntersectionToShape(ShapeIntersection other)
    {
        return Intersection.intersectionPixelToShape(getActor(), other.getActor(), other.getShape());
    }
 }
 